package com.xxx.course.controller;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.xxx.course.common.Result;
import com.xxx.course.entity.EduChapter;
import com.xxx.course.entity.course.Chapter;
import com.xxx.course.service.EduChapterService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 * 课程 前端控制器
 * </p>
 *
 * @author chn
 * @since 2022-06-08
 */
@RestController
@RequestMapping("/chapter")
@CrossOrigin
public class EduChapterController {
    @Autowired
    private EduChapterService eduChapterService;
    @PostMapping("get/{courseId}")
    public Result get(@PathVariable String courseId){
        List<EduChapter> list = eduChapterService.list(new QueryWrapper<EduChapter>().eq("course_id",courseId));
        return Result.ok().data("chapter",list);
    }
}

